// ##############################
// ####  note:  bokeweilai common main fun
// ####  create:  TANWENHUI (twh:谭文辉)
// ####  date:   2024/6/18
// ##############################

#include "bkwl_common.h"
#include "bkwl_data.h"
#include "bkwl_network.h"
#include "bkwl_log.h"
#include "bkwl_event.h"

bkwl_main_t *bkwl_main;
bk_err_t bkwl_common_main()
{
	bk_err_t ret = BK_OK;
	int32 num = 0;
	printf("bkwl_common_main entry\n\n");
	bkwl_main = (bkwl_main_t *)os_malloc(sizeof(bkwl_main_t));

	// 1. twh init log
	ret = bkwl_log_init();
	// 2. twh init data
	ret = bkwl_data_init();
	// 3. twh init gpio
	// 4. twh init net
	ret = bkwl_network_init();
	// 5. twh init device
	// 6. twh init event
	ret = bkwl_event_init();

	while (1)
	{
		printf("twh bkwl_common_main num=%d\n\n", num);
		if (num > 0xffff)
			num = 0;
		num++;
		rtos_delay_milliseconds(100000);
	}

	LOGD("bkwl_common_main exit\n\n");
	return ret;
}
